#!/bin/bash

#
# CS 153 - Spring 2011
# Preparation script for project submission
#
#  This script check for the nachos folder, a README file and then
# compresses the java files found in subfolders:
#
#    nachos/threads/*.java                  (proj 1)
#    nachos/userprog/*.java                 (proj 2)
#    nachos/vm/*.java                       (proj 3)
#
# @author Adam Dou
#


# check nachos folder exists
if [[ ! -d "nachos" ]]; then
  echo "ERROR: nachos folder not found."
  exit 1
fi

# check README file exists
if [[ ! -e "README" ]]; then
  echo "ERROR: no README file found."
  exit 1
fi


# compress project
tar czf turnin.tgz README nachos/threads/*.java nachos/userprog/*.java nachos/vm/*.java

echo ""
echo "#####################################"
echo "#                                   #"
echo "#  Submit 'turnin.tgz', good luck!  #"
echo "#                                   #"
echo "#####################################"
echo ""
